import { http, request } from './index';
import type { QuestionCreatePayload, QuestionItem, QuestionType } from '@/types/question';

interface QuestionListParams {
  type?: QuestionType;
  page?: number;
  size?: number;
}

export const submitQuestion = (payload: QuestionCreatePayload) =>
  request<QuestionItem>(http.post('/v1/questions', payload));

export const fetchQuestions = (params?: QuestionListParams) =>
  request<QuestionItem[]>(http.get('/v1/questions', { params }));

